
/*
 * 1. Open file and read its contents
 * 2. 
 */
package ImportDataFromPhone;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;


/**
 *
 * @author ash
 */
class InputFileReader {

    private String fileName;
    private Container<RawRecord> recordList;
    
    InputFileReader(String source){
        fileName = source;
        recordList = new Container<>(RawRecord.class);
    }
    
    static Container<RawRecord> getRecords(String fileName){
        InputFileReader fr = new InputFileReader(fileName);
        return fr.readRecords();
    }

    private Container<RawRecord> readRecords(){
      
        try {
            BufferedReader in = new BufferedReader(new FileReader(fileName));
            String str="";
            while ((str = in.readLine()) != null) {
                recordList.add(new RawRecord(str));
            }
            in.close();
        } catch (IOException e) {
            System.out.println(e.getMessage());
        }

        return recordList;
    }
    

    
}
